{layout  name="public:layout" /}
<div class="content">

    <div class="header">

        <h1 class="page-title">修改密码</h1>
    </div>

    <ul class="breadcrumb">
        <li><a href="#">基本设置</a> <span class="divider">/</span></li>

        <li class="active">修改密码</li>
    </ul>

    <div class="container-fluid">
        <div class="row-fluid">

            <div class="btn-toolbar">
                &nbsp;
                <!--                <a href="#myModal" data-toggle="modal1" class="btn">Delete</a>-->
                <div class="btn-group">
                </div>
            </div>
            <div class="well" style="margin-top: -15px;">
       
                <div id="myTabContent" class="tab-content">
                  
                    <div class="tab-pane active in" id="profile">
                        <form id="tab2" name="form2"  onsubmit="return false">
                            <label>原密码</label>
                            <input name="u_password" type="password" class="input-xlarge">
                            <label>新密码</label>
                            <input name="n_password" type="password" class="input-xlarge">
                            <label>确认密码</label>
                            <input name="q_password" type="password" class="input-xlarge">
                            <div>
                                <button class="btn btn-primary save2">保存</button>
                            </div>
                        </form>
                    </div>
                </div>

                <script>
                    $(".save2").click(function () {
                        $.ajax({
                            type: "post",
                            url: "{:url('admin/Index/updatepass')}",
                            data: $("[name=form2]").serialize(),
                            dataType: 'json',
                            success: function (data) {
                                if (data.status == 1)
                                {
                                    layer.load(1, {
                                        shade: [0.1, ''], //0.1透明度的白色背景
                                        time: 1000
                                    });
                                    setTimeout(function () {
                                        layer.msg(data.message, {time: 1000}, function () {
                                            window.location.href = "{:url('admin/Index/logout')}";
                                        });
                                    }, 1000);
                                } else if (data.status == 3)
                                {
                                    layer.load(1, {
                                        shade: [0.1, ''], //0.1透明度的白色背景
                                        time: 500
                                    });
                                    setTimeout(function () {
                                        layer.msg(data.message, {time: 1000});
                                    }, 500);

                                } else {
                                    layer.load(1, {
                                        shade: [0.1, ''], //0.1透明度的白色背景
                                        time: 500
                                    });
                                    setTimeout(function () {
                                        layer.msg(data.message, {time: 1000});
                                    }, 500);
                                }
                            }
                        })


                    })
                </script>

            </div>
            <footer>
                <hr>

                <p class="pull-right">Collect from <a href="#" title="网页模板" >sxddd</a></p>


                <p>&copy; 2019 <a href="#" >Portnine</a></p>
            </footer>

        </div>
    </div>
    <script  type="text/javascript">
        function PreviewImage(imgFile) {
            var filextension = imgFile.value.substring(imgFile.value
                    .lastIndexOf("."), imgFile.value.length);
            filextension = filextension.toLowerCase();
            if ((filextension != '.jpg') && (filextension != '.gif')
                    && (filextension != '.jpeg') && (filextension != '.png')
                    && (filextension != '.bmp')) {
                alert("对不起，系统仅支持标准格式的照片，请您调整格式后重新上传，谢谢 !");
                imgFile.focus();
            } else {
                var path;

                if (document.all)//IE
                {
                    imgFile.select();
                    path = document.selection.createRange().text;



                    document.getElementById("photo_info").innerHTML = "";
                    document.getElementById("photo_info").style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='scale',src=\""
                            + path + "\")"; //使用滤镜效果
                } else//FF
                {
                    path = window.URL.createObjectURL(imgFile.files[0]); // FF 7.0以上

                    var file = imgFile.files[0];
                    var reader = new FileReader();
                    reader.readAsDataURL(file);
                    reader.onload = function (e) {    //成功读取文件
                        var img = document.getElementById("selectImg");
                        img.src = e.target.result;   //或 img.src = this.result / e.target == this

//                        alert(img.src);


                    };
                    //alert(path);
//                    $("[name=img2]").val(path);
                    //path = imgFile.files[0].getAsDataURL();// FF 3.0
                    document.getElementById("photo_info").innerHTML = "<img id='img' src='" + path + "' style='width:80px;height:80px;'/>";
                    //document.getElementById("img1").src = path;
                }
            }
        }
    </script>
</div>